#include<bits/stdc++.h>
using namespace std;

int main () {
    string str;
    cin >> str;
    set<int> Set;
    vector<int> arr;
    vector<int> idx;
    for (unsigned int i = 0; i < str.length(); i++) {
        Set.insert(str[i] - '0'); // set保存数据可以去掉重复的
    }
    for (auto& s : Set) {
        arr.push_back(s); // 将数据放入vector容器 可以降序排列
    }
    sort(arr.rbegin(), arr.rend()); // 降序排序

    for (unsigned int i = 0; i < str.length(); i++) { 
        for (unsigned int j = 0; j < arr.size(); j++) {
            if (arr[j] == str[i] - '0') {
                idx.push_back(j);
                break;
            }
        }
    }
    cout << "int[] arr = new int[]{";
    for (int i = 0; i < arr.size() ; i++) {
       if (i < arr.size() - 1)  cout << arr[i] << ","; 
       else  cout << arr[i]; 
    }
    cout << "};" <<endl;
    cout << "int[] index = new int[]{";
    for (int i = 0; i < idx.size() ; i++) {
       if (i < idx.size() - 1)  cout << idx[i] << ","; 
       else  cout << idx[i]; 
    }
    cout << "};" <<endl;
    return 0;
}